using UnityEngine;
using System.Collections;

public class CameraFollowState: State<CameraControl> 
{
	#region Singleton

    private static CameraFollowState instance = new CameraFollowState();
    public static CameraFollowState Instance { get { return instance; } }
    private CameraFollowState() { }

    #endregion
	
    #region State

    public override void OnEnter(CameraControl behaviour)
    {
		//Debug.Log("Follow");
    }

    public override void OnUpdate(CameraControl behaviour)
    {
		behaviour.currentTargetDistance = behaviour.viewDelimiter.newVPPosition + behaviour.distance;		
        behaviour.moveDistance = behaviour.CalculateMoveDistance(behaviour.currentTargetDistance);
		behaviour.Move(behaviour.moveDistance, behaviour.currentTargetDistance);
        
        // Final Tasks
        behaviour.targetDistance = behaviour.currentTargetDistance;
		behaviour.mainCamera.transform.eulerAngles = behaviour.camRotation;
    }

    public override void OnExit(CameraControl behaviour)
    {
        
    }

    public override void OnAction(string name, CameraControl behaviour, object value)
    {
    }

    #endregion
}
